package com.mxf.code.product_coupon.service.impl;

import com.mxf.code.product_coupon.domain.Coupon;
import com.mxf.code.product_coupon.domain.Member;
import com.mxf.code.product_coupon.domain.Product;
import com.mxf.code.product_coupon.service.ProductService;
import com.mxf.code.product_coupon.strategy.PriceCalculator;

import java.math.BigDecimal;
import java.util.List;

/**
 * 商品业务实现类
 *
 * @author 28382
 */
public class ProductServiceImpl implements ProductService {
    private final PriceCalculator priceCalculator;

    public ProductServiceImpl(PriceCalculator priceCalculator) {
        this.priceCalculator = priceCalculator;
    }

    @Override
    public BigDecimal calculatePrice(List<Product> productList, Member member, Coupon coupon) {
        return priceCalculator.calculateTotalPrice(productList, member, coupon);
    }
}
